<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
  x:Class="OpenLS.Drawing.UI.FillResources"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:drawingui="clr-namespace:OpenLS.Drawing.UI"
  xmlns:Internals="clr-namespace:OpenLS.Drawing.UI.Internals;assembly="
  xmlns:Internals1="clr-namespace:OpenLS.UI.Internals;assembly=OpenLS.UI"
    >
    <ResourceDictionary.MergedDictionaries>
        <drawingui:ColorResources/>
        <drawingui:GradientResources/>
    </ResourceDictionary.MergedDictionaries>
    <CollectionViewSource x:Key ="fillColors"
  Source="{Binding Source={x:Static drawingui:ColorManager.UIColors}}">
        <CollectionViewSource.GroupDescriptions>
            <drawingui:ColorGrouping/>
        </CollectionViewSource.GroupDescriptions>
    </CollectionViewSource>

    <DataTemplate DataType="{x:Type Internals:ShapeFillFormatter}">
        <StackPanel  >
            <StackPanel.Resources>
                <CollectionViewSource Source="{Binding Colors}" x:Key="colors">
                    <CollectionViewSource.GroupDescriptions>
                        <drawingui:ColorGrouping/>
                    </CollectionViewSource.GroupDescriptions>
                </CollectionViewSource>

            </StackPanel.Resources>
            <RadioButton Content="{x:Static Internals:UIStringTable.NoFill}" Name="noFill" IsChecked="{Binding IsNone, Mode=OneTime}" Command="{Binding SetNoFillCommand}"/>
            <RadioButton Content="{x:Static Internals:UIStringTable.SolidFill}" Name="solidFill" IsChecked="{Binding IsSolid, Mode=OneTime}" Command="{Binding SetSolidFillCommand}"
                         CommandParameter="{Binding ElementName=colors, Path=SelectedItem}"/>
            <RadioButton Content="{x:Static Internals:UIStringTable.GradientFill}" Name="gradientFill" IsChecked="{Binding IsGradient, Mode=OneTime}" Command="{Binding SetGradientFillCommand}"/>
            <RadioButton Content="{x:Static Internals:UIStringTable.PictureOrTextureFill}" Name="pictureFill"  IsChecked="{Binding IsPictureOrTexctureFill, Mode=OneTime}"/>
            <RadioButton Content="{x:Static Internals:UIStringTable.Automatic}" Name="automatic" IsChecked="{Binding IsAutomatic, Mode=OneTime}" Command="{Binding SetAutomaticFillCommand}"/>
            <StackPanel Orientation ="Horizontal" Name="solidFillPanel" Visibility="Collapsed">
                <TextBlock Text="{x:Static Internals1:UIStringTable.Color}"/>
                <ComboBox SelectedIndex ="-1" Name="colors"
                  Tag="{Binding Source={StaticResource colors}}" 
                          Style="{StaticResource {x:Static drawingui:DrawingKeys.ColorComboBoxStyleKey}}">
                </ComboBox>
            </StackPanel>
            <ContentControl Content="{Binding ShapeProperties.FillProperties}" Visibility="Collapsed" Name="gradientContentControl"></ContentControl>
        </StackPanel>

        <DataTemplate.Triggers>
            <Trigger SourceName="solidFill" Property="IsChecked" Value="True">
                <Setter TargetName="colors" Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"></Setter>
                <Setter TargetName="colors" Property="SelectedItem" Value="{Binding SeletedColor}"></Setter>
            </Trigger>
            <Trigger SourceName="gradientFill" Property="IsChecked" Value="True">
                <Setter TargetName="gradientContentControl" Property="Visibility" Value="Visible"/>
            </Trigger>
            <Trigger SourceName="solidFill" Property="IsChecked" Value="True">
                <Setter TargetName="solidFillPanel" Property="Visibility" Value="Visible"/>
            </Trigger>
        </DataTemplate.Triggers>
    </DataTemplate>

</ResourceDictionary>